package utils
{
	import com.common.window.Panel;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	public class Alert
	{
		public function Alert()
		{
		}
		public static function showAlert(msg:String):void
		{
			var panel:Panel = new Panel(200, 110);
			panel.btnClose.addEventListener(MouseEvent.CLICK, onClick);
			var txt:TextField = new TextField();
			txt.selectable = false;
			txt.defaultTextFormat = new TextFormat("黑体", 20, 0x00, true);
			txt.autoSize = TextFieldAutoSize.LEFT;
			txt.width = panel.width;
			txt.text = msg;
			txt.y = (panel.height - txt.height) * .5;
			panel.addChild(txt);
			Main.application.popUpManager.addPopup(panel);
			
			function onClick(event:Event):void{
				panel.btnClose.removeEventListener(MouseEvent.CLICK, onClick);
				Main.application.popUpManager.removePopUp(panel);
			}
		}
	}
}